package nc.impl.pub;

import java.lang.reflect.Field;

import nc.vo.pub.SuperVO;

public class StringUtils {

	public static void batchReplaceNullString(SuperVO vo) throws IllegalArgumentException, IllegalAccessException {
		for (Field f : vo.getClass().getDeclaredFields()) {
			f.setAccessible(true);

			String type = f.getType().toString();
			if (type.contains("String")) {
				String field = f.getName().toLowerCase();
				if (field.equals("dr")) {
					continue;
				}
				nc.bs.logging.Logger.error(field);
				Object o = vo.getAttributeValue(field);
				if (o == null) {
					vo.setAttributeValue(field, "");
				}
			}
		}
	}

	public static String replaceNullString(String str) {
		if (str == null)
			return "";
		else
			return str;
	}
}
